/*
 * Copyright 2013-2019 Xia Jun(3979434@qq.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ***************************************************************************************
 *                                                                                     *
 *                        Website : http://www.farsunset.com                           *
 *                                                                                     *
 ***************************************************************************************
 */
package com.workcell.workdata.im.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "t_hoxin_user")
public class User{

    public static final byte GENDER_MAN = 1;

    public static final byte GENDER_FEMALE = 0;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @Column(name = "password", length = 64,nullable = false)
    @JsonIgnore
    private String password;

    @Column(name = "name", length = 16,nullable = false)
    private String name;

    @Column(name = "telephone", length = 15,nullable = false)
    private String telephone;

    @Column(name = "organization_id")
    private Long organizationId;

    @Column(name = "email", length = 50)
    private String email;

    @Column(name = "gender", length = 1)
    private byte gender = GENDER_MAN;

    @Column(name = "motto", length = 200)
    private String motto;

    @JsonIgnore
    @Column(name = "state", length = 1)
    private Byte state;

    @JsonIgnore
    @Column(name = "create_time",nullable = false)
    private Date createTime;
    @JsonIgnore
    @Column(name = "bind_key")
    private String bindKey;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMotto() {
        return motto;
    }

    public void setMotto(String motto) {
        this.motto = motto;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public byte getGender() {
        return gender;
    }

    public void setGender(byte gender) {
        this.gender = gender;
    }

    public Byte getState() {
        return state;
    }

    public void setState(Byte state) {
        this.state = state;
    }

    public Long getOrganizationId() {
        return organizationId;
    }

    public void setOrganizationId(Long organizationId) {
        this.organizationId = organizationId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getBindKey() {
        return bindKey;
    }

    public void setBindKey(String bindKey) {
        this.bindKey = bindKey;
    }

    @Override
    public String toString() {
        StringBuilder buffer = new StringBuilder();
        buffer.append("{");
        buffer.append(",").append("name:").append("'").append(name == null ? "" : name).append("'");
        buffer.append(",").append("telephone:").append("'").append(telephone == null ? "" : telephone).append("'");
        buffer.append(",").append("gender:").append("'").append(gender).append("'");
        buffer.append(",").append("email:").append("'").append(email == null ? "" : email).append("'");
        buffer.append("}");
        return buffer.toString();
    }

}
